package laugh.util;

import java.sql.Timestamp;
import java.util.Locale;
import java.util.TimeZone;

import org.apache.commons.lang.time.FastDateFormat;

/**
 * 
*    
* 项目名称：LaughFactory   
* 类名称：DateUtil   
* 类描述：   
* 创建人：wizard   
* 创建时间：2012-3-31 上午10:27:44   
* 修改人：wizard   
* 修改时间：2012-3-31 上午10:27:44   
* 修改备注：   
* @version 0.9
*
 */
public class DateUtil {

//    private static final String dfWithoutTime = "yyyy-MM-dd";
    private static final String dfWithTime = "yyyy-MM-dd HH:mm:ss";

    private static FastDateFormat fdfWithTime = FastDateFormat.getInstance(
            dfWithTime, TimeZone.getDefault(), Locale.getDefault());
//    private static FastDateFormat fdfWithoutTime = FastDateFormat.getInstance(
//            dfWithoutTime, TimeZone.getDefault(), Locale.getDefault());

    /**
     * 将java.sql.timestamp转为String
     * 
     * @param timestamp
     * @return String
     */
    public static String timestamp2String(Timestamp timestamp) {
        return fdfWithTime.format(timestamp);
    }

}
